function result=GSSL(x,y,l_ind)
%FUNCTION `GSSL` @return {kfcv, model, acc}
%   @x      features
%   @y      labels
%   @l_ind  label indexs
    %tic;
    addpath('gssl');

    dis = Distance(x);
    W = ConstructGraph(dis,5);
    component = GetConnectedComponent(W);
    %%loss = zeros(T,1);
    result.kfcv = KFCVHarmonic(dis,W,y,l_ind,component,5);
    result.model = KNN(dis, y, l_ind, 1)
    
    pred = Harmonic(W,y,l_ind,component,result.model);
    u_ind = 1:length(y);
    u_ind(l_ind) = [];
    result.acc = sum(sign(pred(u_ind))==y(u_ind))/length(u_ind);
    %%pred = Harmonic(W,y,l_ind{t},component,KNN(dis,y,l_ind{t},1));
    
    %fprintf('GSSL! passed time: %g\n',toc);
    toc;
end

function kfcv = KFCVHarmonic(dis,W,y,l_ind,comp,K)
    acc = zeros(K, K);
    auc = zeros(K, K);
    for j=1:K
        [train_ind,test_ind] = KFoldSplit(y,l_ind,K);
        for k = 1:K
           pred = Harmonic(W,y,train_ind{k},comp,KNN(dis,y,train_ind{k},1));
           acc(j,k) = sum(sign(pred(test_ind{k}))==y(test_ind{k}))/length(test_ind{k});
           auc(j,k) = AUC(y(test_ind{k}),pred(test_ind{k}));
        end
    end
    kfcv.acc = sum(sum(acc))/(K*K);
    kfcv.auc = sum(sum(auc))/(K*K);
    fprintf('GSSL  kfcv.acc:%f, kfcv.auc:%f\n',kfcv.acc, kfcv.auc);
end